<?php
/**
 * 黑名单管理控制器
 */

namespace Home\Controller;
use Think\Controller;

class BlacklistController extends CommonController{

	 public function _initialize() {
        parent::_initialize();
        $this->dbname = 'cash_'.CONTROLLER_NAME;
    }

    public function _after_list($list,$status){
       // var_dump($list);exit;
        $model = M('user');
        for($i=0;$i<count($list);$i++){
            $list[$i]['create_uid'] = $model->where("id = {$list[$i]['create_uid']}")->field('truename')->find();
        }
        return $list;
    }

    public function _befor_insert($name){
        $model = M('cash_user_info');
        $arr['user_name'] = $_REQUEST['name'];
        $userinfo = $model->where($arr)->field('id,user_idcard')->find();
        $phone = M('cash_user_bank')->field('yu_tel')->where("uid = {$userinfo['id']}")->find();
        $blacklist['uid'] = $userinfo['id'];
        $blacklist['user_idcard'] = $userinfo['user_idcard'];
        $blacklist['user_name'] = $_REQUEST['name'];
        $blacklist['mobile'] = $phone['yu_tel'];
        $blacklist['desc'] = $_REQUEST['desc'];
        $blacklist['create_uid'] = $_REQUEST['belonger'];
        $blacklist['times'] = time();
        return $blacklist;
        
    }


    public function view() {
    	$id = I("get.id");
    	$result = D($this->dbname)->where("id = $id")->field('desc')->find();
        $this->assign('val',$result['desc']);
        $this->display();
    }

}